from bs4 import BeautifulSoup
from urllib.request import urlopen
import re
html = urlopen("https://morvanzhou.github.io/static/scraping/table.html").read().decode('utf-8')
print(html)
soup = BeautifulSoup(html,features='lxml')
img_link = soup.find_all('img',{'src':re.compile('.*?\.jpg')})
print("\n所有jpg格式文件的链接：")
for link in img_link:
    print(link['src'])

print("\n找到所有莫烦提供的学习链接网址：")
learn_link = soup.find_all('a',{'href':re.compile('https://morvanzhou.*')})
for link in learn_link:
    print(link['href'])